import { ElMessageBox } from 'element-plus'

const noop = () => {}
const confirm = options => {
  const {
    beforeClose = noop,
    callback = noop,
    content,
    title,
    tips,
    showCancelButton = true,
  } = options || {}

  ElMessageBox({
    showClose: true,
    draggable: true,
    showCancelButton,
    confirmButtonText: '确定',
    customClass: 'public-confirm',
    confirmButtonClass:'public-confirm-btn',
    title,
    message: (
      <div>
        <div class='flex items-centers'>
          <div class='text-[14px] leading-[20px]'>
            <p class=' text-[#0a1431]'>{content}</p>
            {tips && <p class='text-[#6C7283] mt-[8px]'>{tips}</p>}
          </div>
        </div>
      </div>
    ),
    beforeClose,
  }).then(() => {
    callback?.()
  })
}

export default confirm
